@unframed/cli 0.8.0 → 0.10.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/README.md +2 -0
- package/package.json +1 -1
- package/registry.json +81 -28
- package/skill/unframed/SKILL.md +3 -1
- package/skill/unframed/references/components.md +317 -18
- package/skill/unframed/references/frameworks.md +3 -3
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.10.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
|
|
|
@@ -43,9 +43,11 @@ Unframed 0.8.0: accessible UI components as standard custom elements (Lit). Ever
|
|
|
43
43
|
| Checkbox: Lets users turn an option on or off, or pick several options. | `<uf-checkbox>` `<uf-checkbox-group>` | `@unframed/core/checkbox` `@unframed/core/checkbox-group` |
|
|
44
44
|
| Combobox: Lets users search a list and pick one option. | `<uf-combobox>` | `@unframed/core/combobox` |
|
|
45
45
|
| Date picker: Lets users type or pick a date. | `<uf-date-picker>` `<uf-calendar>` | `@unframed/core/date-picker` `@unframed/core/calendar` |
|
|
46
|
+
| 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` |
|
|
46
47
|
| Dialog: Shows content in a modal window on top of the page. | `<uf-dialog>` | `@unframed/core/dialog` |
|
|
47
48
|
| Drawer: A panel that slides in from an edge of the screen. | `<uf-drawer>` | `@unframed/core/drawer` |
|
|
48
49
|
| Dropdown menu: Opens a menu of actions from a button. | `<uf-dropdown>` `<uf-menu>` `<uf-menu-item>` | `@unframed/core/dropdown` `@unframed/core/menu` |
|
|
50
|
+
| File upload: Lets users choose files to upload. | `<uf-file-upload>` | `@unframed/core/file-upload` |
|
|
49
51
|
| Icon: Shows a small symbol. | `<uf-icon>` | `@unframed/core/icon` |
|
|
50
52
|
| Input: Lets users enter a single line of text. | `<uf-input>` | `@unframed/core/input` |
|
|
51
53
|
| Pagination: Moves between the pages of a long list. | `<uf-pagination>` | `@unframed/core/pagination` |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Unframed 0.
|
|
1
|
+
# Unframed 0.10.0 components
|
|
2
2
|
|
|
3
3
|
## Accordion
|
|
4
4
|
|
|
@@ -207,7 +207,7 @@ Six colors by meaning, in three appearances: `soft` (the default), `solid` and `
|
|
|
207
207
|
|---|---|---|---|---|
|
|
208
208
|
| `variant` | | `BadgeVariant` | `'neutral'` | Color, by meaning: `neutral`, `accent`, `info`, `success`, `warning` or `danger`. |
|
|
209
209
|
| `appearance` | | `BadgeAppearance` | `'soft'` | `soft` (tinted background), `solid` (bold background) or `outline` (border only). |
|
|
210
|
-
| `size` | | `BadgeSize` | `'md'` | Size: `sm` or `
|
|
210
|
+
| `size` | | `BadgeSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
211
211
|
| `dot` | | `boolean` | `false` | Shows a status dot before the text. |
|
|
212
212
|
|
|
213
213
|
#### Slots
|
|
@@ -434,11 +434,11 @@ Every section is optional; empty ones take no space.
|
|
|
434
434
|
</uf-card>
|
|
435
435
|
```
|
|
436
436
|
|
|
437
|
-
###
|
|
437
|
+
### Appearance and orientation
|
|
438
438
|
|
|
439
439
|
```html
|
|
440
|
-
<uf-card
|
|
441
|
-
<uf-card
|
|
440
|
+
<uf-card appearance="elevated">…</uf-card>
|
|
441
|
+
<uf-card appearance="filled">…</uf-card>
|
|
442
442
|
<uf-card orientation="horizontal">
|
|
443
443
|
<img slot="media" src="/cover.png" alt="" />
|
|
444
444
|
Media beside the content.
|
|
@@ -451,7 +451,7 @@ Every section is optional; empty ones take no space.
|
|
|
451
451
|
|
|
452
452
|
| Attribute | Property | Type | Default | Description |
|
|
453
453
|
|---|---|---|---|---|
|
|
454
|
-
| `
|
|
454
|
+
| `appearance` | | `CardAppearance` | `'outline'` | `outline` (a border), `elevated` (a shadow, or an accent glow in dark mode) or `filled` (a tinted background). |
|
|
455
455
|
| `orientation` | | `CardOrientation` | `'vertical'` | `vertical`, or `horizontal` to put the media beside the content. |
|
|
456
456
|
|
|
457
457
|
#### Slots
|
|
@@ -526,6 +526,7 @@ Tags: `<uf-checkbox>`, `<uf-checkbox-group>`. Import: `import '@unframed/core/ch
|
|
|
526
526
|
| `hint` | | `string \| undefined` | | Help text below the label. |
|
|
527
527
|
| `checked` | `defaultChecked` | `boolean` | `false` | Initial state, restored on form reset. Set with the `checked` attribute. |
|
|
528
528
|
| `value` | | `string` | `'on'` | Value submitted with the form when checked. |
|
|
529
|
+
| `size` | | `FieldSize` | `'md'` | Size of the control and its label: `sm`, `md` or `lg`. |
|
|
529
530
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
530
531
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
531
532
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -599,12 +600,6 @@ Tags: `<uf-checkbox>`, `<uf-checkbox-group>`. Import: `import '@unframed/core/ch
|
|
|
599
600
|
|---|---|---|
|
|
600
601
|
| `value` | `string[]` | The values of the checked checkboxes (other than "select all"). |
|
|
601
602
|
|
|
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
603
|
#### Events
|
|
609
604
|
|
|
610
605
|
| Event | Type | Description |
|
|
@@ -732,6 +727,9 @@ Type to filter, arrow keys to move, Enter to pick.
|
|
|
732
727
|
| Property | Description |
|
|
733
728
|
|---|---|
|
|
734
729
|
| `--uf-combobox-max-height` | Maximum height of the list before it scrolls. |
|
|
730
|
+
| `--uf-field-bg` | Background of the box. |
|
|
731
|
+
| `--uf-field-border-color` | Border color of the box. |
|
|
732
|
+
| `--uf-field-radius` | Corner radius of the box. |
|
|
735
733
|
|
|
736
734
|
## Date picker
|
|
737
735
|
|
|
@@ -871,6 +869,9 @@ Type a date in the page language's format, or open the calendar. The value is al
|
|
|
871
869
|
| `min` | | `string \| undefined` | | The earliest date that can be picked, as `YYYY-MM-DD`. |
|
|
872
870
|
| `max` | | `string \| undefined` | | The latest date that can be picked, as `YYYY-MM-DD`. |
|
|
873
871
|
| `first-day-of-week` | `firstDayOfWeek` | `number \| undefined` | | First day of the week: 0 Sunday … 6 Saturday. Defaults to the language's. |
|
|
872
|
+
| `range` | | `boolean` | `false` | Picks a range, from `start` to `end`, instead of one date. |
|
|
873
|
+
| `start` | | `string` | `''` | With `range`, the first date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
874
|
+
| `end` | | `string` | `''` | With `range`, the last date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
874
875
|
|
|
875
876
|
#### Properties only
|
|
876
877
|
|
|
@@ -888,7 +889,7 @@ Type a date in the page language's format, or open the calendar. The value is al
|
|
|
888
889
|
|
|
889
890
|
| Event | Type | Description |
|
|
890
891
|
|---|---|---|
|
|
891
|
-
| `change` | `Event` | The user picked a date
|
|
892
|
+
| `change` | `Event` | The user picked a date (read `value`), or, with `range`, completed a range (read `start` and `end`). |
|
|
892
893
|
|
|
893
894
|
#### CSS parts
|
|
894
895
|
|
|
@@ -903,6 +904,188 @@ Type a date in the page language's format, or open the calendar. The value is al
|
|
|
903
904
|
| `day` | Every day. |
|
|
904
905
|
| `selected` | The selected day. |
|
|
905
906
|
| `today` | Today. |
|
|
907
|
+
| `range-start` | With `range`, the start date. |
|
|
908
|
+
| `range-end` | With `range`, the end date. |
|
|
909
|
+
| `in-range` | With `range`, a day between the start and the end. |
|
|
910
|
+
|
|
911
|
+
#### CSS custom properties
|
|
912
|
+
|
|
913
|
+
| Property | Description |
|
|
914
|
+
|---|---|
|
|
915
|
+
| `--uf-calendar-day-size` | Width and height of a day. |
|
|
916
|
+
|
|
917
|
+
## Date range picker
|
|
918
|
+
|
|
919
|
+
A date range field: type the start and end dates in the page language's
|
|
920
|
+
format, or pick both from a calendar. The value is an ISO 8601 interval,
|
|
921
|
+
`YYYY-MM-DD/YYYY-MM-DD`, the same in every language, and it submits with the
|
|
922
|
+
form; `start` and `end` hold the two dates.
|
|
923
|
+
|
|
924
|
+
Alt + Down Arrow opens the calendar; Escape closes it.
|
|
925
|
+
|
|
926
|
+
Tags: `<uf-date-range-picker>`, `<uf-calendar>`. Import: `import '@unframed/core/date-range-picker';`, `import '@unframed/core/calendar';` (or `npx @unframed/cli add date-range-picker calendar` to copy the source).
|
|
927
|
+
|
|
928
|
+
### Basic
|
|
929
|
+
|
|
930
|
+
Type the two dates, or pick them in the calendar: the first click sets the start, the second the end.
|
|
931
|
+
|
|
932
|
+
```html
|
|
933
|
+
<uf-date-range-picker name="stay" label="Stay" hint="Check-in from 3 pm"></uf-date-range-picker>
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
- The value is an ISO 8601 interval, `2026-10-14/2026-10-18`, the same in every language; `start` and `end` hold the two dates.
|
|
937
|
+
- The format, month names and first day of the week follow the nearest `lang`.
|
|
938
|
+
|
|
939
|
+
### Limits and validation
|
|
940
|
+
|
|
941
|
+
`min`, `max` and `isDateDisabled`, as in the date picker. A missing or reversed date gets its own message.
|
|
942
|
+
|
|
943
|
+
```html
|
|
944
|
+
<uf-date-range-picker name="leave" label="Leave" required min="2026-10-20" max="2027-01-18"></uf-date-range-picker>
|
|
945
|
+
<script>
|
|
946
|
+
// A function, so it's set as a property.
|
|
947
|
+
document.querySelector('uf-date-range-picker').isDateDisabled = (iso) => [0, 6].includes(new Date(iso).getUTCDay());
|
|
948
|
+
</script>
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
### Calendar on its own
|
|
952
|
+
|
|
953
|
+
`<uf-calendar range>` picks a range inline, e.g. on a booking page. `change` fires when both dates are picked.
|
|
954
|
+
|
|
955
|
+
```html
|
|
956
|
+
<uf-calendar range start="2026-10-22" end="2026-10-26"></uf-calendar>
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
### `<uf-date-range-picker>` API
|
|
960
|
+
|
|
961
|
+
#### Attributes and properties
|
|
962
|
+
|
|
963
|
+
| Attribute | Property | Type | Default | Description |
|
|
964
|
+
|---|---|---|---|---|
|
|
965
|
+
| `value` | `defaultValue` | `string` | `''` | Initial range, restored on form reset. Set with the `value` attribute, as `YYYY-MM-DD/YYYY-MM-DD`. |
|
|
966
|
+
| `label` | | `string \| undefined` | | The field's label, also its accessible name. |
|
|
967
|
+
| `hint` | | `string \| undefined` | | Help text below the field. |
|
|
968
|
+
| `placeholder` | | `string \| undefined` | | Shown in both inputs when empty. Defaults to the date format, e.g. dd/mm/yyyy. |
|
|
969
|
+
| `size` | | `FieldSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
970
|
+
| `min` | | `string \| undefined` | | The earliest allowed date, as `YYYY-MM-DD`. |
|
|
971
|
+
| `max` | | `string \| undefined` | | The latest allowed date, as `YYYY-MM-DD`. |
|
|
972
|
+
| `readonly` | | `boolean` | `false` | Lets the user select the text but not change the dates. |
|
|
973
|
+
| `open` | | `boolean` | `false` | Whether the calendar is open. |
|
|
974
|
+
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
975
|
+
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
976
|
+
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
977
|
+
|
|
978
|
+
#### Properties only
|
|
979
|
+
|
|
980
|
+
| Property | Type | Description |
|
|
981
|
+
|---|---|---|
|
|
982
|
+
| `start` | `string` | The first date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
983
|
+
| `end` | `string` | The last date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
984
|
+
| `isDateDisabled` | `((date: string) => boolean) \| undefined` | Rules out dates, e.g. weekends: called with each date as `YYYY-MM-DD`, returns true to disable it. |
|
|
985
|
+
| `value` | `string` | The range as an ISO 8601 interval, `YYYY-MM-DD/YYYY-MM-DD`, or an empty string until both dates are set. |
|
|
986
|
+
| `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
|
|
987
|
+
| `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
|
|
988
|
+
| `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
|
|
989
|
+
| `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
|
|
990
|
+
|
|
991
|
+
#### Methods
|
|
992
|
+
|
|
993
|
+
| Method | Description |
|
|
994
|
+
|---|---|
|
|
995
|
+
| `show()` | Opens the calendar. |
|
|
996
|
+
| `hide()` | Closes the calendar. |
|
|
997
|
+
| `checkValidity()` | Returns whether the value is valid, without showing an error. |
|
|
998
|
+
| `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
|
|
999
|
+
| `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
|
|
1000
|
+
|
|
1001
|
+
#### Events
|
|
1002
|
+
|
|
1003
|
+
| Event | Type | Description |
|
|
1004
|
+
|---|---|---|
|
|
1005
|
+
| `input` | `Event` | The range changed (a date was typed and committed, or both were picked). |
|
|
1006
|
+
| `change` | `Event` | The range changed (a date was typed and committed, or both were picked). |
|
|
1007
|
+
| `uf-show` | | The calendar opened. |
|
|
1008
|
+
| `uf-hide` | | The calendar closed. |
|
|
1009
|
+
|
|
1010
|
+
#### Slots
|
|
1011
|
+
|
|
1012
|
+
| Slot | Description |
|
|
1013
|
+
|---|---|
|
|
1014
|
+
| `label` | The label, when you need markup. Overrides `label`. |
|
|
1015
|
+
| `hint` | Help text below the field. Overrides `hint`. |
|
|
1016
|
+
|
|
1017
|
+
#### CSS parts
|
|
1018
|
+
|
|
1019
|
+
| Part | Description |
|
|
1020
|
+
|---|---|
|
|
1021
|
+
| `field` | The wrapper around label, control, hint and error. |
|
|
1022
|
+
| `form-label` | The label. |
|
|
1023
|
+
| `box` | The bordered box around the inputs. |
|
|
1024
|
+
| `start-input` | The start date input. |
|
|
1025
|
+
| `end-input` | The end date input. |
|
|
1026
|
+
| `separator` | The dash between the two inputs. |
|
|
1027
|
+
| `toggle` | The calendar button. |
|
|
1028
|
+
| `popup` | The floating panel around the calendar. |
|
|
1029
|
+
| `calendar` | The `<uf-calendar>`. |
|
|
1030
|
+
| `hint` | The hint text. |
|
|
1031
|
+
| `error` | The validation message. |
|
|
1032
|
+
|
|
1033
|
+
#### CSS custom properties
|
|
1034
|
+
|
|
1035
|
+
| Property | Description |
|
|
1036
|
+
|---|---|
|
|
1037
|
+
| `--uf-field-bg` | Background of the box. |
|
|
1038
|
+
| `--uf-field-border-color` | Border color of the box. |
|
|
1039
|
+
| `--uf-field-radius` | Corner radius of the box. |
|
|
1040
|
+
|
|
1041
|
+
### `<uf-calendar>` API
|
|
1042
|
+
|
|
1043
|
+
#### Attributes and properties
|
|
1044
|
+
|
|
1045
|
+
| Attribute | Property | Type | Default | Description |
|
|
1046
|
+
|---|---|---|---|---|
|
|
1047
|
+
| `value` | | `string` | `''` | The selected date, as `YYYY-MM-DD`, or an empty string. |
|
|
1048
|
+
| `min` | | `string \| undefined` | | The earliest date that can be picked, as `YYYY-MM-DD`. |
|
|
1049
|
+
| `max` | | `string \| undefined` | | The latest date that can be picked, as `YYYY-MM-DD`. |
|
|
1050
|
+
| `first-day-of-week` | `firstDayOfWeek` | `number \| undefined` | | First day of the week: 0 Sunday … 6 Saturday. Defaults to the language's. |
|
|
1051
|
+
| `range` | | `boolean` | `false` | Picks a range, from `start` to `end`, instead of one date. |
|
|
1052
|
+
| `start` | | `string` | `''` | With `range`, the first date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
1053
|
+
| `end` | | `string` | `''` | With `range`, the last date of the range, as `YYYY-MM-DD`, or an empty string. |
|
|
1054
|
+
|
|
1055
|
+
#### Properties only
|
|
1056
|
+
|
|
1057
|
+
| Property | Type | Description |
|
|
1058
|
+
|---|---|---|
|
|
1059
|
+
| `isDateDisabled` | `((date: string) => boolean) \| undefined` | Rules out dates, e.g. weekends: called with each date as `YYYY-MM-DD`, returns true to disable it. |
|
|
1060
|
+
|
|
1061
|
+
#### Methods
|
|
1062
|
+
|
|
1063
|
+
| Method | Description |
|
|
1064
|
+
|---|---|
|
|
1065
|
+
| `focus(options: FocusOptions)` | Moves keyboard focus to the selected day, or today. |
|
|
1066
|
+
|
|
1067
|
+
#### Events
|
|
1068
|
+
|
|
1069
|
+
| Event | Type | Description |
|
|
1070
|
+
|---|---|---|
|
|
1071
|
+
| `change` | `Event` | The user picked a date (read `value`), or, with `range`, completed a range (read `start` and `end`). |
|
|
1072
|
+
|
|
1073
|
+
#### CSS parts
|
|
1074
|
+
|
|
1075
|
+
| Part | Description |
|
|
1076
|
+
|---|---|
|
|
1077
|
+
| `base` | The calendar. |
|
|
1078
|
+
| `header` | The month title and the previous and next buttons. |
|
|
1079
|
+
| `title` | The month and year. |
|
|
1080
|
+
| `nav-button` | The previous and next month buttons. |
|
|
1081
|
+
| `grid` | The `<table>` of days. |
|
|
1082
|
+
| `weekday` | A weekday heading. |
|
|
1083
|
+
| `day` | Every day. |
|
|
1084
|
+
| `selected` | The selected day. |
|
|
1085
|
+
| `today` | Today. |
|
|
1086
|
+
| `range-start` | With `range`, the start date. |
|
|
1087
|
+
| `range-end` | With `range`, the end date. |
|
|
1088
|
+
| `in-range` | With `range`, a day between the start and the end. |
|
|
906
1089
|
|
|
907
1090
|
#### CSS custom properties
|
|
908
1091
|
|
|
@@ -1078,6 +1261,7 @@ A modal panel from the end edge. Escape, the close button and any element with `
|
|
|
1078
1261
|
| Property | Description |
|
|
1079
1262
|
|---|---|
|
|
1080
1263
|
| `--uf-drawer-size` | Width of a side drawer, or height of a top or bottom one. Defaults to `24rem`. |
|
|
1264
|
+
| `--uf-drawer-radius` | Corner radius of the corners on the open side; the side against the screen edge stays square. |
|
|
1081
1265
|
| `--uf-dialog-bg` | Background of the drawer. |
|
|
1082
1266
|
| `--uf-dialog-padding` | Padding of header, body and footer. |
|
|
1083
1267
|
| `--uf-dialog-backdrop` | Backdrop color. |
|
|
@@ -1214,6 +1398,110 @@ Arrow keys move, typing a letter jumps to an item, Escape closes.
|
|
|
1214
1398
|
| `checkmark` | The check shown for checked checkbox items. |
|
|
1215
1399
|
| `label` | The label wrapper. |
|
|
1216
1400
|
|
|
1401
|
+
## File upload
|
|
1402
|
+
|
|
1403
|
+
Picks files to send with a form: from a button, or by dragging them onto the
|
|
1404
|
+
drop zone. The chosen files are listed with their size and a remove button.
|
|
1405
|
+
Files that don't match `accept` or are larger than `max-size` are refused,
|
|
1406
|
+
with a message saying why. It submits like a native `<input type="file">`.
|
|
1407
|
+
|
|
1408
|
+
Tags: `<uf-file-upload>`. Import: `import '@unframed/core/file-upload';` (or `npx @unframed/cli add file-upload` to copy the source).
|
|
1409
|
+
|
|
1410
|
+
### Basic
|
|
1411
|
+
|
|
1412
|
+
A button and a drop zone. The chosen files are listed with their size and a remove button.
|
|
1413
|
+
|
|
1414
|
+
```html
|
|
1415
|
+
<uf-file-upload name="attachments" label="Attachments" hint="PDF or images, up to 5 MB each" multiple accept=".pdf, image/*" max-size="5000000"></uf-file-upload>
|
|
1416
|
+
```
|
|
1417
|
+
|
|
1418
|
+
- Files that `accept` rules out, or larger than `max-size` (in bytes), are refused, with a message saying why.
|
|
1419
|
+
- It submits with its form like a native file input: `new FormData(form).getAll("attachments")` returns the files.
|
|
1420
|
+
|
|
1421
|
+
### One file, required
|
|
1422
|
+
|
|
1423
|
+
Without `multiple`, a new pick replaces the file. `required` makes the form ask for one.
|
|
1424
|
+
|
|
1425
|
+
```html
|
|
1426
|
+
<form>
|
|
1427
|
+
<uf-file-upload name="cv" label="Your CV" accept=".pdf" required></uf-file-upload>
|
|
1428
|
+
<uf-button type="submit">Apply</uf-button>
|
|
1429
|
+
</form>
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
### `<uf-file-upload>` API
|
|
1433
|
+
|
|
1434
|
+
#### Attributes and properties
|
|
1435
|
+
|
|
1436
|
+
| Attribute | Property | Type | Default | Description |
|
|
1437
|
+
|---|---|---|---|---|
|
|
1438
|
+
| `label` | | `string \| undefined` | | Visible label. |
|
|
1439
|
+
| `hint` | | `string \| undefined` | | Help text, e.g. the accepted types and size. |
|
|
1440
|
+
| `accept` | | `string \| undefined` | | Accepted files, as in a native file input: extensions (`.pdf`), MIME types (`image/png`) or wildcards (`image/*`), comma-separated. |
|
|
1441
|
+
| `multiple` | | `boolean` | `false` | Lets users choose more than one file. |
|
|
1442
|
+
| `max-size` | `maxSize` | `number \| undefined` | | Largest accepted file, in bytes, e.g. `5000000` for 5 MB. |
|
|
1443
|
+
| `size` | | `FieldSize` | `'md'` | Size of the drop zone: `sm`, `md` or `lg`. |
|
|
1444
|
+
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1445
|
+
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1446
|
+
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
1447
|
+
|
|
1448
|
+
#### Properties only
|
|
1449
|
+
|
|
1450
|
+
| Property | Type | Description |
|
|
1451
|
+
|---|---|---|
|
|
1452
|
+
| `files` | `File[]` | The chosen files. Set it to `[]` to clear them. |
|
|
1453
|
+
| `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
|
|
1454
|
+
| `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
|
|
1455
|
+
| `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
|
|
1456
|
+
| `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
|
|
1457
|
+
|
|
1458
|
+
#### Methods
|
|
1459
|
+
|
|
1460
|
+
| Method | Description |
|
|
1461
|
+
|---|---|
|
|
1462
|
+
| `showPicker()` | Opens the file picker. |
|
|
1463
|
+
| `checkValidity()` | Returns whether the value is valid, without showing an error. |
|
|
1464
|
+
| `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
|
|
1465
|
+
| `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
|
|
1466
|
+
|
|
1467
|
+
#### Events
|
|
1468
|
+
|
|
1469
|
+
| Event | Type | Description |
|
|
1470
|
+
|---|---|---|
|
|
1471
|
+
| `input` | `Event` | Fired when files are added or removed. |
|
|
1472
|
+
| `change` | `Event` | Fired when files are added or removed. |
|
|
1473
|
+
|
|
1474
|
+
#### Slots
|
|
1475
|
+
|
|
1476
|
+
| Slot | Description |
|
|
1477
|
+
|---|---|
|
|
1478
|
+
| `label` | The label, when you need markup. Overrides `label`. |
|
|
1479
|
+
| `hint` | Help text below the label. Overrides `hint`. |
|
|
1480
|
+
|
|
1481
|
+
#### CSS parts
|
|
1482
|
+
|
|
1483
|
+
| Part | Description |
|
|
1484
|
+
|---|---|
|
|
1485
|
+
| `field` | The wrapper around label, drop zone, files, hint and error. |
|
|
1486
|
+
| `form-label` | The label. |
|
|
1487
|
+
| `dropzone` | The area files can be dropped on. |
|
|
1488
|
+
| `button` | The button that opens the file picker. |
|
|
1489
|
+
| `files` | The list of chosen files. |
|
|
1490
|
+
| `file` | A chosen file. |
|
|
1491
|
+
| `remove-button` | A file's remove button. |
|
|
1492
|
+
| `rejected` | Why files were refused. |
|
|
1493
|
+
| `hint` | The hint text. |
|
|
1494
|
+
| `error` | The validation message. |
|
|
1495
|
+
|
|
1496
|
+
#### CSS custom properties
|
|
1497
|
+
|
|
1498
|
+
| Property | Description |
|
|
1499
|
+
|---|---|
|
|
1500
|
+
| `--uf-file-upload-border-color` | Border color of the drop zone. |
|
|
1501
|
+
| `--uf-file-upload-bg` | Background of the drop zone. |
|
|
1502
|
+
| `--uf-file-upload-radius` | Corner radius of the drop zone. Defaults to the theme's control radius. |
|
|
1503
|
+
| `--uf-file-upload-active-color` | Border and background tint while files are dragged over. |
|
|
1504
|
+
|
|
1217
1505
|
## Icon
|
|
1218
1506
|
|
|
1219
1507
|
An icon from the built-in set, or one added with `registerIcons()`.
|
|
@@ -1414,7 +1702,7 @@ Long ranges collapse around the current page; the number of buttons stays the sa
|
|
|
1414
1702
|
| `pages` | | `number` | `1` | How many pages there are. |
|
|
1415
1703
|
| `siblings` | | `number` | `1` | How many pages to show on each side of the current one. |
|
|
1416
1704
|
| `label` | | `string \| undefined` | | Accessible name of the navigation, e.g. "Search results pages". Defaults to "Pagination", or its translation. |
|
|
1417
|
-
| `size` | | `PaginationSize` | `'md'` | Size: `sm` or `
|
|
1705
|
+
| `size` | | `PaginationSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
1418
1706
|
|
|
1419
1707
|
#### Events
|
|
1420
1708
|
|
|
@@ -1543,7 +1831,7 @@ Leave out `value` when the length of the work is not known.
|
|
|
1543
1831
|
| `label` | | `string \| undefined` | | Visible label, also the bar's accessible name. Without one, it's named "Progress". |
|
|
1544
1832
|
| `show-value` | `showValue` | `boolean` | `false` | Shows the percentage next to the label. |
|
|
1545
1833
|
| `variant` | | `ProgressVariant` | `'accent'` | Color, by meaning: `accent`, `success`, `warning` or `danger`. |
|
|
1546
|
-
| `size` | | `ProgressSize` | `'md'` | Height of the bar: `sm` or `
|
|
1834
|
+
| `size` | | `ProgressSize` | `'md'` | Height of the bar: `sm`, `md` or `lg`. |
|
|
1547
1835
|
|
|
1548
1836
|
#### Slots
|
|
1549
1837
|
|
|
@@ -1600,6 +1888,7 @@ Arrow keys move the selection; only the selected radio is in the tab order.
|
|
|
1600
1888
|
| `label` | | `string \| undefined` | | Visible group label. |
|
|
1601
1889
|
| `hint` | | `string \| undefined` | | Help text below the options. |
|
|
1602
1890
|
| `orientation` | | `'vertical' \| 'horizontal'` | `'vertical'` | Lays the options out in a column or a row. |
|
|
1891
|
+
| `size` | | `FieldSize` | `'md'` | Size of the radios and their labels: `sm`, `md` or `lg`. |
|
|
1603
1892
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1604
1893
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1605
1894
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -1676,7 +1965,7 @@ Arrow keys move the selection; only the selected radio is in the tab order.
|
|
|
1676
1965
|
| Property | Description |
|
|
1677
1966
|
|---|---|
|
|
1678
1967
|
| `--uf-radio-size` | Size of the circle. |
|
|
1679
|
-
| `--uf-radio-checked-
|
|
1968
|
+
| `--uf-radio-checked-bg` | Color of the circle when checked. |
|
|
1680
1969
|
|
|
1681
1970
|
## Select
|
|
1682
1971
|
|
|
@@ -1811,6 +2100,7 @@ A native range input underneath: arrow keys, Page Up/Down, Home and End, touch,
|
|
|
1811
2100
|
| `label` | | `string \| undefined` | | Visible label, also the slider's accessible name. |
|
|
1812
2101
|
| `hint` | | `string \| undefined` | | Help text below the slider. |
|
|
1813
2102
|
| `show-value` | `showValue` | `boolean` | `false` | Shows the current value next to the label. |
|
|
2103
|
+
| `size` | | `FieldSize` | `'md'` | Size of the track and handle: `sm`, `md` or `lg`. |
|
|
1814
2104
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1815
2105
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1816
2106
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -1864,7 +2154,7 @@ A native range input underneath: arrow keys, Page Up/Down, Home and End, touch,
|
|
|
1864
2154
|
|---|---|
|
|
1865
2155
|
| `--uf-slider-track-height` | Height of the track. |
|
|
1866
2156
|
| `--uf-slider-track-color` | Color of the track's empty part. |
|
|
1867
|
-
| `--uf-slider-
|
|
2157
|
+
| `--uf-slider-indicator-color` | Color of the track up to the handle. |
|
|
1868
2158
|
| `--uf-slider-thumb-size` | Diameter of the handle. |
|
|
1869
2159
|
|
|
1870
2160
|
## Spinner
|
|
@@ -1941,6 +2231,7 @@ Tags: `<uf-switch>`. Import: `import '@unframed/core/switch';` (or `npx @unframe
|
|
|
1941
2231
|
| `hint` | | `string \| undefined` | | Help text below the label. |
|
|
1942
2232
|
| `checked` | `defaultChecked` | `boolean` | `false` | Initial state, restored on form reset. Set with the `checked` attribute. |
|
|
1943
2233
|
| `value` | | `string` | `'on'` | Value submitted with the form when checked. |
|
|
2234
|
+
| `size` | | `FieldSize` | `'md'` | Size of the control and its label: `sm`, `md` or `lg`. |
|
|
1944
2235
|
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1945
2236
|
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1946
2237
|
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
@@ -2132,7 +2423,7 @@ Tags: `<uf-tabs>`, `<uf-tab>`, `<uf-tab-panel>`. Import: `import '@unframed/core
|
|
|
2132
2423
|
|
|
2133
2424
|
| Attribute | Property | Type | Default | Description |
|
|
2134
2425
|
|---|---|---|---|---|
|
|
2135
|
-
| `
|
|
2426
|
+
| `value` | | `string` | `''` | Name of the selected panel. Defaults to the first enabled tab. |
|
|
2136
2427
|
| `activation` | | `'auto' \| 'manual'` | `'auto'` | `auto` selects a tab as soon as it gets focus; `manual` waits for Enter or Space. |
|
|
2137
2428
|
| `orientation` | | `'horizontal' \| 'vertical'` | `'horizontal'` | Lays the tab list out horizontally or vertically. |
|
|
2138
2429
|
| `label` | | `string \| undefined` | | Accessible name for the tab list. |
|
|
@@ -2383,6 +2674,13 @@ Tags: `<uf-tooltip>`. Import: `import '@unframed/core/tooltip';` (or `npx @unfra
|
|
|
2383
2674
|
| `show()` | Shows the tooltip, unless it's disabled. |
|
|
2384
2675
|
| `hide()` | Hides the tooltip. |
|
|
2385
2676
|
|
|
2677
|
+
#### Events
|
|
2678
|
+
|
|
2679
|
+
| Event | Type | Description |
|
|
2680
|
+
|---|---|---|
|
|
2681
|
+
| `uf-show` | `Event` | The tooltip opened. |
|
|
2682
|
+
| `uf-hide` | `Event` | The tooltip closed. |
|
|
2683
|
+
|
|
2386
2684
|
#### Slots
|
|
2387
2685
|
|
|
2388
2686
|
| Slot | Description |
|
|
@@ -2402,3 +2700,4 @@ Tags: `<uf-tooltip>`. Import: `import '@unframed/core/tooltip';` (or `npx @unfra
|
|
|
2402
2700
|
| `--uf-tooltip-bg` | Background color. |
|
|
2403
2701
|
| `--uf-tooltip-color` | Text color. |
|
|
2404
2702
|
| `--uf-tooltip-max-width` | Maximum width. |
|
|
2703
|
+
| `--uf-tooltip-radius` | Corner radius. Square by default. |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Using Unframed 0.
|
|
1
|
+
# Using Unframed 0.10.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.10/dist/tokens.css" />
|
|
72
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.10/+esm"></script>
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
75
|
<uf-button variant="primary">It works</uf-button>
|