From 0e045bda111ce5ab88a472dfad71557369a81d5c Mon Sep 17 00:00:00 2001 From: upsiflu Date: Wed, 4 Dec 2024 16:06:34 +0100 Subject: [PATCH] chore(ui): make imports consistent; modernize `useProps` and `useModel` WIP: #2355 --- front/src/components/ui/Activity.vue | 56 +-- front/src/components/ui/Alert.vue | 5 +- front/src/components/ui/Button.vue | 50 +-- front/src/components/ui/Card.vue | 18 +- front/src/components/ui/Input.vue | 19 +- front/src/components/ui/Loader.vue | 4 +- front/src/components/ui/Markdown.vue | 7 +- front/src/components/ui/Modal.vue | 8 +- front/src/components/ui/Pagination.vue | 50 ++- front/src/components/ui/Pill.vue | 5 +- front/src/components/ui/Popover.vue | 9 +- front/src/components/ui/SanitizedHtml.vue | 12 +- front/src/components/ui/Tab.vue | 11 +- front/src/components/ui/Tabs.vue | 2 +- front/src/components/ui/Textarea.vue | 68 ++- front/src/components/ui/Toc.vue | 8 +- front/src/components/ui/Toggle.vue | 6 +- front/src/components/ui/button/Options.vue | 6 +- front/src/components/ui/button/Play.vue | 8 +- .../components/ui/popover/PopoverCheckbox.vue | 8 +- .../src/components/ui/popover/PopoverItem.vue | 4 +- .../components/ui/popover/PopoverRadio.vue | 12 +- .../ui/popover/PopoverRadioItem.vue | 6 +- .../components/ui/popover/PopoverSubmenu.vue | 14 +- front/src/composables/colors.ts | 11 +- front/src/utils/event-validators.ts | 5 + front/ui-docs/components/ui/activity.md | 112 ++++- front/ui-docs/components/ui/alert.md | 57 +-- front/ui-docs/components/ui/button.md | 134 +++--- front/ui-docs/components/ui/button/options.md | 8 +- front/ui-docs/components/ui/button/play.md | 8 +- front/ui-docs/components/ui/card.md | 66 +-- front/ui-docs/components/ui/input.md | 39 +- front/ui-docs/components/ui/layout.md | 44 +- front/ui-docs/components/ui/layout/spacer.md | 6 +- front/ui-docs/components/ui/loader.md | 10 +- front/ui-docs/components/ui/modal.md | 120 ++--- front/ui-docs/components/ui/pagination.md | 6 +- front/ui-docs/components/ui/pill.md | 78 ++-- front/ui-docs/components/ui/popover.md | 409 +++++++++--------- front/ui-docs/components/ui/tabs.md | 64 +-- front/ui-docs/components/ui/textarea.md | 13 +- front/ui-docs/components/ui/toc.md | 20 +- front/ui-docs/components/ui/toggle.md | 10 +- front/ui-docs/index.md | 9 +- 45 files changed, 877 insertions(+), 748 deletions(-) create mode 100644 front/src/utils/event-validators.ts diff --git a/front/src/components/ui/Activity.vue b/front/src/components/ui/Activity.vue index 564022cfa..fdfa1ba7c 100644 --- a/front/src/components/ui/Activity.vue +++ b/front/src/components/ui/Activity.vue @@ -1,69 +1,61 @@ diff --git a/front/src/components/ui/Alert.vue b/front/src/components/ui/Alert.vue index d08835f7a..2a6a10300 100644 --- a/front/src/components/ui/Alert.vue +++ b/front/src/components/ui/Alert.vue @@ -1,6 +1,5 @@ diff --git a/front/src/components/ui/Card.vue b/front/src/components/ui/Card.vue index 232ee720a..b7c278853 100644 --- a/front/src/components/ui/Card.vue +++ b/front/src/components/ui/Card.vue @@ -1,12 +1,14 @@ diff --git a/front/src/components/ui/Loader.vue b/front/src/components/ui/Loader.vue index 6a2afbcc3..f8647910d 100644 --- a/front/src/components/ui/Loader.vue +++ b/front/src/components/ui/Loader.vue @@ -1,5 +1,5 @@ diff --git a/front/src/components/ui/Markdown.vue b/front/src/components/ui/Markdown.vue index dd8a3864a..b90f06faf 100644 --- a/front/src/components/ui/Markdown.vue +++ b/front/src/components/ui/Markdown.vue @@ -1,11 +1,10 @@ diff --git a/front/src/components/ui/Modal.vue b/front/src/components/ui/Modal.vue index 80158c8ff..51ef88745 100644 --- a/front/src/components/ui/Modal.vue +++ b/front/src/components/ui/Modal.vue @@ -1,5 +1,7 @@ @@ -10,7 +12,7 @@ const open = defineModel({ required: true }) @@ -197,12 +211,12 @@ If there are multiple actions, they will be presented in a row: You cannot undo this action. ``` @@ -211,12 +225,12 @@ If there are multiple actions, they will be presented in a row: You cannot undo this action. diff --git a/front/ui-docs/components/ui/input.md b/front/ui-docs/components/ui/input.md index 191b8c3a2..cac8b84b5 100644 --- a/front/ui-docs/components/ui/input.md +++ b/front/ui-docs/components/ui/input.md @@ -1,54 +1,53 @@ + + # Input Inputs are areas in which users can enter information. In Funkwhale, these mostly take the form of search fields. -| Prop | Data type | Required? | Description | -| --------------- | --------- | --------- | --------------------------------------------------------------------------- | -| `placeholder` | String | No | The placeholder text that appears when the input is empty. | -| `icon` | String | No | The [Bootstrap icon](https://icons.getbootstrap.com/) to show on the input. | -| `v-model:value` | String | Yes | The text entered in the input. | +| Prop | Data type | Required? | Description | +| ---- | --------- | --------- | ----------- | + +| +| `placeholder` | String | No | The placeholder text that appears when the input is empty. | +| `icon` | String | No | The [Bootstrap icon](https://icons.getbootstrap.com/) to show on the input. | +| `v-model:value` | String | Yes | The text entered in the input. | ## Input model You can link a user's input to form data by referencing the data in a `v-model` directive. ```vue-html{2} - + ``` - + ## Input icons Add a [Bootstrap icon](https://icons.getbootstrap.com/) to an input to make its purpose more visually clear. ```vue-html{3} - + ``` - + ## Input-right slot You can add a template on the right-hand side of the input to guide the user's input. ```vue-html{2-4} - + - + ``` - + - + diff --git a/front/ui-docs/components/ui/layout.md b/front/ui-docs/components/ui/layout.md index 698adbf95..3eecc4cc2 100644 --- a/front/ui-docs/components/ui/layout.md +++ b/front/ui-docs/components/ui/layout.md @@ -1,15 +1,17 @@ # Layout The following containers are responsive. Change your window's size or select a device preset from your browser's dev tools to see how layouts are affected by available space. - - + + Items are laid out in a row and wrapped as they overflow the container. By default, all items in a row assume the same (maximum) height. @@ -23,7 +25,7 @@ By default, all items in a row assume the same (maximum) height. ``` -
+
@@ -37,22 +39,20 @@ By default, all items in a row assume the same (maximum) height. Find a list of all styles here: [Flexbox guide on css-tricks.com](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) - -
- --gap: 4px - align-self: flex-end - flex-grow: 1 - height: 5rem - width: 100% - -
- +
+ --gap: 4px + align-self: flex-end + flex-grow: 1 + height: 5rem + width: 100% + +
::: - - + + Align items both vertically and horizontally @@ -112,9 +112,9 @@ Align items both vertically and horizontally
- + - + Add space between vertically stacked items @@ -142,6 +142,6 @@ Add space between vertically stacked items - + - + diff --git a/front/ui-docs/components/ui/layout/spacer.md b/front/ui-docs/components/ui/layout/spacer.md index a4730dc26..06485374b 100644 --- a/front/ui-docs/components/ui/layout/spacer.md +++ b/front/ui-docs/components/ui/layout/spacer.md @@ -1,7 +1,7 @@